<div id = "main">
	<div class = "container">
		<div class = "page_title">机器人状态</div>
		<form id = "loginForm" action = "runqq.php" method = "post">
			<input type = "hidden" name = "rsa_pass" id = "rsa_pass" />
			<input type = "hidden" id = "code" value = "<?php echo $qq['code']; ?>" />
			<ul class = "form_ul">
				<li><span class = "form_span"><?php echo $qq['is_run'] == 0 ? "<font color = \"red\">未运行</font>" : ("<font color = \"green\">已运行-</font>" . $statusDes); ?></span></li>
				<li><span class = "form_span">监控密钥：<font color = "green"><?php echo $qq['secret']; ?></font></span></li>
				<li><label class = "form_label" for = "uin"><i class = "fa fa-qq fa-fw"></i></label><input class = "form_input" type = "text" id = "uin" name = "uin" value = "<?php echo $qq['uin'];?>" readonly = "readonly" /></li>
				<?php if ($qq['is_run'] == 1 && $qq['status'] == StatusUtil::LOADING_VERIFY) { ?>
				<li><label class = "form_label"><i class = "fa fa-image fa-fw"></i></label><a href = "img.php?uin=<?php echo $qq['uin']; ?>" target = "_blank" title = "新窗口打开验证码"><img src = "img.php?uin=<?php echo $qq['uin']; ?>" /></a></li>
				<li><label class = "form_label" for = "verification"><i class = "fa fa-file-text fa-fw"></i></label><input class = "form_input" type = "text" id = "verification" name = "verification" placeholder = "验证码" /></li>
				<?php } ?>
				<?php if ($qq['is_run'] == 1 && ($qq['status'] == StatusUtil::LOADING_VERIFY || $qq['status'] == StatusUtil::LOADING_RSA)) { ?>
				<li><input class = "form_button" type = "button" value = "登录" onclick = "login()" /></li>
				<?php } ?>
			</ul>
		</form>
		<div class = "page_title">运行记录</div>
		<ul class = "ul_none">
		<?php if ($logs) { ?>
		<?php foreach ($logs as $log) { ?>
		<li><?php echo $log['msg'] . "<i class = \"fa fa-clock-o fa-fw\"></i>" . date('Y-m-d H:i:s', $log['createdate']);?></li>
		<?php } ?>
		<?php } else { ?>
		<li>无运行记录，如需运行请加监控。</li>
		<?php } ?>
		</ul>
	</div>
</div>

<?php if ($qq['is_run'] == 1) { ?>
<script type = "text/javascript">
function login() {
	<?php if ($qq['status'] == StatusUtil::LOADING_RSA) { ?>
	var code = document.getElementById("code").value;
	<?php } elseif ($qq['status'] == StatusUtil::LOADING_VERIFY) { ?>
	var code = document.getElementById("verification").value;
	<?php } ?>
	if (code.length != 4) {
		alert("无效的登录");
		return false;
	}
	var rsa_pass = getEncryption("<?php echo $qq['pass']; ?>", "<?php echo $qq['uin']; ?>", code, false);
	document.getElementById("rsa_pass").value = rsa_pass;
	document.getElementById("loginForm").submit();
}
</script>
<?php } ?>